<!--
 * @Author: weidewei
 * @Date: 2025-11-19 10:58:01
 * @LastEditors: weidewei
 * @LastEditTime: 2025-11-19 14:06:44
 * @Description: 
 * @FilePath: \2025-front-face\html&css\三列布局.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    /* flex 布局
    .box {
        display: flex;
    }
    .left,.right {
        width: 300px;
        height: 200px;
        border: 1px solid red;
    }
    .middle{
        flex: 1;
        border: 1px solid;
    } */

     /* grid布局 
     .box {
        display: grid;
        grid-template-columns: 120px 1fr 120px;
        height: 300px;
    }
    .left,.right {
        border: 1px solid red;
    }
    .middle{
        border: 1px solid;
    }  */

    .box {
        position: relative;
        height: 300px;
        overflow: hidden;
        padding: 0 200px;
    }
    .left,.right {
        border: 1px solid #ff0000;
    }
    .left {
        width: 200px;
        margin-left: -200px;
        float: left;
    }
    .right {
        width: 200px;
        margin-right: -200px;
        float: right;
    }
    .middle{
        float: left;
        width: 100%;
        border: 1px solid;
    } 
</style>
<body>
    <div class="box">
        <div class="left">左</div>
        <div class="middle">中</div>
        <div class="right">右</div>
    </div>
</body>
</html>